@Inject('$http')
class GlobalService {
  queryPost(param) {
    return this.$http.post('/api/v1/codeDict/postion/query', param);
  }

  queryDept(param) {
    return this.$http.post('/api/v1/codeDict/dept/query', param);
  }

  queryDeviceCategory(param) {
    return this.$http.post('/api/v1/codeDict/deviceCategory/query', param);
  }

  queryDeviceUsedLocation(param) {
    return this.$http.post('/api/v1/codeDict/deviceUsedLocation/query', param);
  }

  queryDeptType() {
    return this.$http.get('/web/api/codeDict/deptType/get');
  }

  querySystemDicByType(typeName) {
    return this.$http({
      url: '/api/v1/codeDict/systemSettingCodeDictList',
      method: 'GET',
      params: { typeName },
    });
  }

  queryAllOrg() {
    return this.$http.get('/api/v1/safetyTable/queryOrgList');
  }

  queryOrgWorker(orgId) {
    return this.$http({
      url: '/api/v1/safetyTable/queryStaffByOrgId',
      method: 'GET',
      params: { orgId },
    });
  }

  // 附件预览
  previewDoc(fileId) {
    return this.$http({
      url: '/api/v1/common/preview',
      method: 'GET',
      params: { fileId },
    });
  }

  // 获取用户权限(内业资料获取施工单位、建设单位、监理单位)
  getUserManageRange(orgType) {
    return this.$http({
      url: '/api/v1/userManageRange/getManageRangeByOrgType',
      method: 'GET',
      params: { orgType },
    });
  }

  // 获取用户权限(内业资料获取施工单位)
  getConsManageRange() {
    return this.$http({
      url: '/api/v1/userManageRange/getManageConstructionUnit',
      method: 'GET',
    });
  }
}

export default GlobalService;
